package com.hjqjl.moduledemob.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ToastUtils;
import com.hjqjl.moduledemob.databinding.DemobActivityMainBinding;
import com.hjqjl.whapplib.base.BaseActivity;
import com.hjqjl.whapplib.router.RouterPath;

// 在支持路由的页面上添加注解(必选)
// 这里的路径需要注意的是至少需要有两级，/xx/xx
@Route(path = RouterPath.DEMOB_MAIN)
public class MainActivity extends BaseActivity<DemobActivityMainBinding> {
    @Autowired(name = "key1")
    public String str;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("DemoB");
        pVBinding.demobTvMain.setText("this is moduleB==>" + str);
        ToastUtils.showShort("this is moduleB==>" + str);
        pVBinding.demobBtnMainTolauncher.setOnClickListener(v -> ARouter.getInstance().build(RouterPath.LAUNCHER_MAIN).navigation());
        pVBinding.demobBtnMainTodemoa.setOnClickListener(v -> ARouter.getInstance().build(RouterPath.DEMOA_MAIN).navigation());
        pVBinding.demobBtnMainToResult.setOnClickListener(v -> {
            Intent intent = new Intent();
            intent.putExtra("key_name", "来自于DemoB的setResult返回结果");
            setResult(RESULT_OK, intent);
            finish();
        });
    }
}